<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>朱元璋经典语录 - 美观卡片版</title>
    <style>
        /* 引入新的卡片样式 */
        @import url('cc_updated.css');
        /* 已移至外部CSS文件 */
        
        @keyframes float {
            0% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-10px);
            }
            100% {
                transform: translateY(0);
            }
        }
        
        @keyframes pulse {
            0% {
                transform: scale(1);
                box-shadow: 0 10px 25px rgba(139, 0, 0, 0.2);
            }
            50% {
                transform: scale(1.02);
                box-shadow: 0 15px 30px rgba(139, 0, 0, 0.3), 0 0 15px rgba(255, 215, 0, 0.3);
            }
            100% {
                transform: scale(1);
                box-shadow: 0 10px 25px rgba(139, 0, 0, 0.2);
            }
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Microsoft YaHei", "SimSun", "STKaiti", sans-serif;
        }
        
        body {
            background-color: #f9f3e9;
            color: #333;
            padding: 20px;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.03"><path d="M0,0 L100,100 M100,0 L0,100" stroke="%23d4a76a" stroke-width="1"/></svg>');
            min-height: 100vh;
        }
        
        header {
            text-align: center;
            margin-bottom: 40px;
            padding: 20px 0;
            position: relative;
        }
        
        h1 {
            font-size: 2.8rem;
            color: #8B0000;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
            margin-bottom: 10px;
            font-weight: bold;
            letter-spacing: 2px;
        }
        
        .subtitle {
            font-size: 1.3rem;
            color: #666;
            margin-top: 5px;
            font-style: italic;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 30px;
        }
        
        .card {
            background: linear-gradient(135deg, #fff9f0 0%, #fff5e5 100%);
            border-radius: 20px;
            box-shadow: 0 10px 25px rgba(139, 0, 0, 0.2), inset 0 -2px 4px rgba(255, 255, 255, 0.4);
            overflow: hidden;
            transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
            position: relative;
            aspect-ratio: 4/5;
            display: flex;
            flex-direction: column;
            border: 3px solid transparent;
            border-image: linear-gradient(135deg, #ffdab9, #e8d5b5);
            border-image-slice: 1;
            transform-style: preserve-3d;
            perspective: 1000px;
            backdrop-filter: blur(5px);
        }
        
        .card:hover {
            transform: translateY(-15px) rotate(-2deg) scale(1.03);
            box-shadow: 0 20px 40px rgba(139, 0, 0, 0.3), 0 0 20px rgba(255, 215, 0, 0.3);
            border-image: linear-gradient(135deg, #ffd700, #ffa500);
            border-image-slice: 1;
            filter: brightness(1.08);
            animation: shimmer 3s infinite linear;
        }
        
        .card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 50%);
            z-index: 1;
            pointer-events: none;
        }
        
        .card-header {
            background: linear-gradient(135deg, #8B0000 0%, #a50000 100%);
            color: #fff;
            padding: 20px;
            font-size: 1.6rem;
            font-weight: bold;
            text-align: center;
            flex-shrink: 0;
            letter-spacing: 1px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.5);
            border-bottom: 4px solid #5a0000;
            position: relative;
            clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
            padding-bottom: 25px;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.1"><path d="M0,50 L100,50 M50,0 L50,100" stroke="%23ffffff" stroke-width="1"/></svg>');
        }
        
        .card-header::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 0;
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-top: 8px solid #5a0000;
        }
        
        .card-body {
            padding: 35px 30px;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            text-align: center;
            background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 60%);
        }
        
        .quote {
            font-size: 1.6rem;
            line-height: 1.9;
            margin-bottom: 25px;
            font-style: italic;
            color: #5a0000;
            font-family: "STKaiti", "KaiTi", serif;
            padding: 0 15px;
            position: relative;
            text-shadow: 0 0 1px rgba(139, 0, 0, 0.2);
            font-weight: bold;
        }
        
        .quote::before {
            content: '“';
            font-size: 3rem;
            position: absolute;
            top: -20px;
            left: -10px;
            color: rgba(139, 0, 0, 0.2);
        }
        
        .quote::after {
            content: '”';
            font-size: 3rem;
            position: absolute;
            bottom: -40px;
            right: -10px;
            color: rgba(139, 0, 0, 0.2);
        }
        
        .context {
            font-size: 1.05rem;
            color: #666;
            border-left: 4px solid #8B0000;
            padding-left: 20px;
            flex-grow: 1;
            text-align: left;
            line-height: 1.7;
            font-family: "Microsoft YaHei", sans-serif;
            position: relative;
        }
        
        .download-btn {
            position: absolute;
            bottom: 15px;
            right: 15px;
            background: linear-gradient(135deg, #8B0000 0%, #a50000 100%);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 30px;
            cursor: pointer;
            font-size: 0.95rem;
            opacity: 0.9;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
            z-index: 2;
            font-weight: bold;
            letter-spacing: 0.5px;
            text-transform: uppercase;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            backdrop-filter: blur(5px);
        }
        
        .download-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: 0.5s;
        }
        
        .download-btn:hover::before {
            left: 100%;
        }
        
        .download-btn:hover {
            opacity: 1;
            background: linear-gradient(135deg, #a50000 0%, #8B0000 100%);
            transform: translateY(-2px) scale(1.05);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3), 0 0 10px rgba(139, 0, 0, 0.5);
            text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
            letter-spacing: 1px;
        }
        
        footer {
            text-align: center;
            margin-top: 50px;
            padding: 20px 0;
            color: #666;
            font-size: 0.9rem;
            border-top: 1px solid #e8d5b5;
            padding-top: 15px;
        }
        
        @media (max-width: 768px) {
            .container {
                grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            }
            
            h1 {
                font-size: 2.2rem;
            }
            
            .subtitle {
                font-size: 1.1rem;
            }
        }
        
        @media (max-width: 480px) {
            .container {
                grid-template-columns: 1fr;
            }
            
            h1 {
                font-size: 1.8rem;
            }
            
            .card {
                max-width: 100%;
            }
        }
    </style>
    <!-- 引入html2canvas库用于将HTML元素转换为图片 -->
    <script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
</head>
<body>
    <header>
        <h1>朱元璋经典语录</h1>
        <p class="subtitle">从乞丐到皇帝的霸气名言</p>
        <style>
            header h1 {
                background: linear-gradient(45deg, #8B0000, #FF8C00);
                -webkit-background-clip: text;
                background-clip: text;
                color: transparent;
                animation: shimmer 5s infinite linear;
                background-size: 200% 100%;
            }
            
            .subtitle {
                background: linear-gradient(45deg, #333, #666);
                -webkit-background-clip: text;
                background-clip: text;
                color: transparent;
                letter-spacing: 1px;
            }
        </style>
    </header>
    
    <div class="container">
        <!-- 卡片1 -->
        <div class="card" id="card1">
            <div class="card-header">草根逆袭</div>
            <div class="card-body">
                <p class="quote">"老子本来就是泥腿子，怕什么？"</p>
                <p class="context">朱元璋出身贫农，当过和尚、乞丐，造反时毫无心理负担。这句话体现了他"光脚的不怕穿鞋的"草根霸气。</p>
            </div>
            <button class="download-btn" onclick="downloadCard('card1', '朱元璋-草根逆袭')">下载卡片 ↓</button>
        </div>
        
        <!-- 卡片2 -->
        <div class="card" id="card2">
            <div class="card-header">帝王权术</div>
            <div class="card-body">
                <p class="quote">"要么不做，要么做绝！"</p>
                <p class="context">朱元璋打仗、治国、杀人都极其果断，比如胡惟庸案、蓝玉案牵连数万人，功臣几乎被杀光。</p>
            </div>
            <button class="download-btn" onclick="downloadCard('card2', '朱元璋-帝王权术')">下载卡片 ↓</button>
        </div>
        
        <!-- 卡片3 -->
        <div class="card" id="card3">
            <div class="card-header">治国铁腕</div>
            <div class="card-body">
                <p class="quote">"贪官污吏，剥皮实草！"</p>
                <p class="context">真实历史政策，贪污60两银子以上就处死，尸体剥皮塞草做成"标本"警示后人。</p>
            </div>
            <button class="download-btn" onclick="downloadCard('card3', '朱元璋-治国铁腕')">下载卡片 ↓</button>
        </div>
        
        <!-- 卡片4 -->
        <div class="card" id="card4">
            <div class="card-header">对功臣的狠</div>
            <div class="card-body">
                <p class="quote">"我的儿子们必须封王，你们的功劳再大也得死！"</p>
                <p class="context">朱元璋怕功臣威胁朱家江山，杀蓝玉、胡惟庸，却大封儿子为藩王。</p>
            </div>
            <button class="download-btn" onclick="downloadCard('card4', '朱元璋-对功臣的狠')">下载卡片 ↓</button>
        </div>
        
        <!-- 卡片5 -->
        <div class="card" id="card5">
            <div class="card-header">经典战略</div>
            <div class="card-body">
                <p class="quote">"高筑墙，广积粮，缓称王。"</p>
                <p class="context">朱升提出的战略，朱元璋完美执行，躲过了元朝和其他起义军的围剿，最终一统天下。</p>
            </div>
            <button class="download-btn" onclick="downloadCard('card5', '朱元璋-经典战略')">下载卡片 ↓</button>
        </div>
    </div>
    
    <footer style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%); padding: 25px 0; border-radius: 15px; margin-top: 60px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);">
        <p style="font-size: 1rem; letter-spacing: 1px;">© 2023 朱元璋经典语录 | 历史内容仅供参考</p>
    </footer>
    
    <script>
        // 添加卡片动画效果
        document.addEventListener('DOMContentLoaded', function() {
            const cards = document.querySelectorAll('.card');
            cards.forEach((card, index) => {
                // 为奇数卡片和偶数卡片添加不同的动画延迟
                if (index % 2 === 0) {
                    card.style.animationDelay = '0.5s';
                } else {
                    card.style.animationDelay = '3s';
                }
            });
        });
        
        // 下载卡片为图片的函数
        function downloadCard(cardId, fileName) {
            // 获取要转换为图片的卡片元素
            const cardElement = document.getElementById(cardId);
            const downloadBtn = cardElement.querySelector('.download-btn');
            
            // 暂时隐藏下载按钮
            if (downloadBtn) {
                downloadBtn.style.display = 'none';
            }
            
            // 添加下载动画效果
            const loadingOverlay = document.createElement('div');
            loadingOverlay.style.position = 'absolute';
            loadingOverlay.style.top = '0';
            loadingOverlay.style.left = '0';
            loadingOverlay.style.width = '100%';
            loadingOverlay.style.height = '100%';
            loadingOverlay.style.backgroundColor = 'rgba(255, 255, 255, 0.7)';
            loadingOverlay.style.display = 'flex';
            loadingOverlay.style.justifyContent = 'center';
            loadingOverlay.style.alignItems = 'center';
            loadingOverlay.style.zIndex = '10';
            loadingOverlay.style.borderRadius = '16px';
            
            const loadingText = document.createElement('div');
            loadingText.textContent = '正在生成图片...';
            loadingText.style.color = '#8B0000';
            loadingText.style.fontWeight = 'bold';
            loadingText.style.fontSize = '1.2rem';
            loadingText.style.textShadow = '0 0 5px rgba(255, 255, 255, 0.5)';
            
            loadingOverlay.appendChild(loadingText);
            cardElement.appendChild(loadingOverlay);
            
            // 使用html2canvas将卡片转换为canvas
            html2canvas(cardElement, {
                scale: 2, // 提高分辨率
                backgroundColor: null, // 透明背景
                logging: false, // 关闭日志
                useCORS: true, // 允许跨域图片
                ignoreElements: (element) => {
                    return element === loadingOverlay || element === downloadBtn;
                }
            }).then(canvas => {
                // 将canvas转换为图片URL
                const imgData = canvas.toDataURL('image/png');
                
                // 创建一个a标签用于下载
                const a = document.createElement('a');
                a.href = imgData;
                a.download = fileName + '.png'; // 设置下载文件名
                document.body.appendChild(a);
                a.click(); // 模拟点击下载
                document.body.removeChild(a); // 移除a标签
                
                // 移除加载动画并显示下载按钮
                cardElement.removeChild(loadingOverlay);
                if (downloadBtn) {
                    downloadBtn.style.display = '';
                }
                
                // 显示下载成功提示
                const successOverlay = document.createElement('div');
                successOverlay.style.position = 'absolute';
                successOverlay.style.bottom = '60px';
                successOverlay.style.left = '50%';
                successOverlay.style.transform = 'translateX(-50%)';
                successOverlay.style.backgroundColor = 'rgba(0, 100, 0, 0.8)';
                successOverlay.style.color = 'white';
                successOverlay.style.padding = '8px 16px';
                successOverlay.style.borderRadius = '20px';
                successOverlay.style.fontSize = '0.9rem';
                successOverlay.style.zIndex = '10';
                successOverlay.textContent = '下载成功！';
                
                cardElement.appendChild(successOverlay);
                
                // 2秒后移除成功提示
                setTimeout(() => {
                    cardElement.removeChild(successOverlay);
                }, 2000);
            });
        }
    </script>
</body>
</html>